package com.zbkj.crmeb.chant.service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.IService;
import com.common.CommonPage;
import com.common.PageParamRequest;
import com.crmeb.core.common.CommonResult;
import com.github.pagehelper.PageInfo;
import com.zbkj.crmeb.category.request.CategoryRequest;
import com.zbkj.crmeb.chant.dto.ChannelMerchantDTO;
import com.zbkj.crmeb.chant.dto.ChannelMerchantSupplierDTO;
import com.zbkj.crmeb.chant.model.ChannelMerchant;
import com.zbkj.crmeb.chant.model.ReserveMoneyDetail;
import com.zbkj.crmeb.chant.request.MerchantListRequest;
import com.zbkj.crmeb.chant.request.PurchaseProductRequest;
import com.zbkj.crmeb.chant.response.ChannelMerchantPurchaseResponse;
import com.zbkj.crmeb.chant.vo.ChannelMerchantVO;
import com.zbkj.crmeb.enums.StockAreaTempEnum;
import com.zbkj.crmeb.merchant.api.response.PickIngConfigResponse;
import com.zbkj.crmeb.store.model.PurchaseGoods;
import com.zbkj.crmeb.store.model.StoreOrder;
import com.zbkj.crmeb.store.model.StoreOrderInfo;
import com.zbkj.crmeb.store.request.StoreOrderRefundRequest;
import com.zbkj.crmeb.store.response.SupplierInfo;
import com.zbkj.crmeb.store.vo.StoreOrderInfoVo;
import com.zbkj.crmeb.system.request.PaymentAccountRequest;

/**
 * 渠道商户
 */
public interface IChannelMerchantService extends IService<ChannelMerchant> {

    /**
     * 渠道商户列表
     * @return
     */
    PageInfo<ChannelMerchantVO> merchantList(MerchantListRequest request);

    /**
     * 渠道商户列表
     * @return
     */
    PageInfo<ChannelMerchantVO> merchantListV2(MerchantListRequest request, boolean onlyWokg);

    /**
     * 删除渠道商户
     * @param id
     * @return
     */
    boolean deleteMerchant(Integer id);

    /**
     * 添加渠道商户
     * @param entity
     * @return
     */
    CommonResult<String> addMerchant(ChannelMerchantDTO entity);

    /**
     * 添加渠道供应商
     * @author daigb
     * @date:  2022-03-18 14:23
     */
    CommonResult<String> addMerchantSupplier(ChannelMerchantSupplierDTO entity);

    /**
     *
     * @param entity
     * @return
     */
    CommonResult<String> updateMerchant(ChannelMerchantDTO entity);
    
    /**
     * 修改供应商
     * @author daigb
     * @date:  2022-03-18 16:05
     */
    CommonResult<String> updateMerchantSupplier(ChannelMerchantSupplierDTO entity);

    /**
     * 获取平台收款账户
     * @return
     */
    PaymentAccountRequest PaymentAccount();

    ChannelMerchantVO getMerchantById(Integer id);

    List<StockAreaTempEnum> getStockArea(Integer merId);

    SupplierInfo getSupplierInfo(Integer merId);

    void purchaseSupplierGood(PurchaseGoods goods, StoreOrderInfoVo orderInfo);

    /**
     * 获取商户信息(已走缓存)
     * @author daigb
     * @date:  2022-04-29 15:20
     */
    ChannelMerchant getChannelMerchantByMerId(Integer merId);

    Boolean updCategoryByChannel(CategoryRequest categoryRequest);

    /**
     * 获取商户配置
     * @param merId
     * @return com.zbkj.crmeb.chant.vo.ChannelMerchantVO
     */
    ChannelMerchantVO getMerchantConfigDetail(Integer merId);

    /**
     * 缓存中获取商户信息
     * @param channelType
     * @param suppliersIds
     * @return com.zbkj.crmeb.chant.model.ChannelMerchant
     */
    ChannelMerchant getMerchantByRelated(Integer channelType,String suppliersIds);


    PickIngConfigResponse getPickingConfig(Integer merId);

    void updateAccountRole(Integer roleCode, String merId);

    void addMerId(Integer merId);

    Boolean merAddRemarks(String remarks, Integer merId);

    Map<String, Object> purchaseProduct(PurchaseProductRequest purchaseProductRequest, String ip);

    Boolean refund(BigDecimal amount, String orderId);

    /**
     * 功能描述: 修改备用金
     * @Param: [merId, add, money]
     * @Return: java.lang.Boolean
     * @Author: wangzh
     * @Date: 2023/5/9 11:59
     */
    Boolean updateReserveMoney(Integer merId, Boolean add, BigDecimal money);

    CommonPage<ReserveMoneyDetail> getDetailList(Integer merId, PageParamRequest pageParamRequest);

    CommonPage<ChannelMerchantPurchaseResponse> getPurchaseList(Integer merId, PageParamRequest request);

    ChannelMerchantPurchaseResponse getPurchaseStatus(String orderId);

}
